<%-- 
    Document   : showCart
    Created on : Jun 21, 2012, 3:20:11 PM
    Author     : Owner
--%>

<%--
<%if (Long.parseLong(String.valueOf(session.getAttribute("loginRoleId"))) == 0) {%>
<%@include file="/jsp/top.jsp"%>
<%} else if (Long.parseLong(String.valueOf(session.getAttribute("loginRoleId"))) == 1) {%>
<%@include file="/jsp/userTop.jsp"%>
<%} else if (Long.parseLong(String.valueOf(session.getAttribute("loginRoleId"))) == 2) {%>
<%@include file="/jsp/adminTop.jsp"%>
<%}%>--%>

<%@include file="/jsp/top.jsp"%>

<html>
    <head>

        <title>View Cart</title>
    </head>
    <body>
        <div class="clear"></div>
        <table cellspacing="5px" width="100%" align="center">
            <tr>
                <td>
                    <table cellspacing="5px" width="100%" align="center">
                        <tr>
                            <td style="vertical-align: top;" width="20%">
                                <%@include file="/jsp/right.jsp" %></td>
                            <td  style="vertical-align: top;" width="80%">
                                <table align="center" border="1" cellspacing="10px" width="100%">
                                    <tr>
                                        <td colspan="2">
                                            <div class="page-title"><h1>Your Shopping Cart</h1></div>
                                        </td>
                                    </tr>
                                    <logic:notPresent name="productCartList" scope="request">
                                        <tr>
                                            <td colspan="2" align="center">
                                                Your Cart is Empty.
                                            </td>
                                        </tr>
                                    </logic:notPresent>
                                    <logic:present name="productCartList" scope="request">
                                        <logic:empty name="productCartList" scope="request">
                                            <tr>
                                                <td colspan="2" align="center">
                                                    Your Cart is Empty.
                                                </td>
                                            </tr>
                                        </logic:empty>
                                        <logic:notEmpty name="productCartList" scope="request">
                                            <tr>
                                                <td colspan="2">
                                                    <table align="center" border="1" cellspacing="10px" width="100%">
                                                        <tr>
                                                            <td><strong>Item</strong></td>
                                                            <td><strong>Name</strong></td>
                                                            <td><strong>Price</strong></td>
                                                            <td><strong>Quantity</strong></td>
                                                            <td><strong>Sub Total</strong></td>
                                                            <td></td>
                                                        </tr>
                                                        <html:form action="/product" method="post">
                                                            <logic:iterate id="cartProducts" name="productCartList" scope="request">
                                                                <tr>
                                                                    <td><a href="./product.do?action=showProductDetails&productId=<bean:write name="cartProducts" property="productId"/>&productName=<bean:write name="cartProducts" property="productName"/>">
                                                                            <img alt="<bean:write name="cartProducts" property="productName"/>" src="products/<bean:write name="cartProducts" property="productSmallImageName"/>" width="50" height="50"/>
                                                                        </a></td>
                                                                    <td><a href="./product.do?action=showProductDetails&productId=<bean:write name="cartProducts" property="productId"/>&productName=<bean:write name="cartProducts" property="productName"/>">
                                                                            <bean:write name="cartProducts" property="productName"/></a></td>
                                                                    <td>Rs. <bean:write name="cartProducts" property="productPrice"/></td>
                                                                    <td><strong>X</strong>&nbsp;<html:text name="cartProducts" property="addToCartQty" size="3px" />
                                                                        <a onclick="javascript:return updateQty('./product.do?action=updateCartProductQty&cartProductId = <bean:write name="cartProducts" property="cartProductId"/>','ProductBean'); "><img alt="Update Qty" src="images/reset_icon.gif"/></a>
                                                                    </td>
                                                                    <td><strong>Rs. <bean:write name="cartProducts" property="productSubTotal"/></strong></td>
                                                                    <td><a href="./product.do?action=removeProductFromCart&cartProductId=<bean:write name="cartProducts" property="cartProductId"/>">
                                                                            <img src="images/deletebin.png" alt="Remove Product" height="25" width="20" /></a>
                                                                    </td>
                                                                </tr>
                                                            </logic:iterate>
                                                        </html:form>
                                                    </table>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td colspan="2"><hr/></td>
                                            </tr>
                                            <logic:present name="cartId" scope="request">
                                                <tr>
                                                    <td align="left" colspan="2">
                                                        <a href="./product.do?action=clearCart&cartId=<bean:write name="cartId"/>">
                                                            <img alt="" src="images/shopping_cart_remove.png" /> Clear Cart</a>
                                                    </td>
                                                    <%-- <td>
                                                        <a href="./product.do?action=updateCart&cartId=<bean:write name="cartId"/>">
                                                            <img alt="Update Cart" src="images/update.png" onmouseover="src='images/update-hover.png'" onmouseout="src='images/update.png'"/>
                                                        </a>
                                                    </td>
                                                    --%>
                                                </tr>
                                            </logic:present>
                                            <logic:present name="cartTotal" scope="request">
                                                <tr>
                                                    <td colspan="2" align="right">
                                                        <strong>Cart Total : Rs.<bean:write name="cartTotal"/></strong>
                                                    </td>
                                                </tr>
                                            </logic:present>
                                        </logic:notEmpty>
                                    </logic:present>
                                    <logic:notPresent name="productCartList" scope="request">
                                        <tr>
                                            <td colspan="2" align="center">
                                                <a href="./menuAction.do?action=showHomeBeforeLogin">
                                                    <img alt="Continue Shopping" src="images/ContinueShopping.png" onmouseover="src='images/ContinueShopping-hover.png'" onmouseout="src='images/ContinueShopping.png'"/>
                                                </a>
                                            </td>
                                        </tr>
                                    </logic:notPresent>
                                    <logic:present name="productCartList" scope="request">
                                        <logic:empty name="productCartList" scope="request">
                                            <tr>
                                                <td colspan="2" align="center">
                                                    <a href="./menuAction.do?action=showHomeBeforeLogin">
                                                        <img alt="Continue Shopping" src="images/ContinueShopping.png" onmouseover="src='images/ContinueShopping-hover.png'" onmouseout="src='images/ContinueShopping.png'"/>
                                                    </a>
                                                </td>
                                            </tr>
                                        </logic:empty>
                                        <logic:notEmpty name="productCartList" scope="request">
                                            <tr>
                                                <td>
                                                    <a href="./menuAction.do?action=showHomeBeforeLogin">
                                                        <img alt="Continue Shopping" src="images/ContinueShopping.png" onmouseover="src='images/ContinueShopping-hover.png'" onmouseout="src='images/ContinueShopping.png'"/>
                                                    </a>
                                                </td>
                                                <td>
                                                    <a href="./userAccount.do?action=checkOut">
                                                        <img alt="CheckOut" src="images/checkout.png" onmouseover="src='images/checkout-hover.png'" onmouseout="src='images/checkout.png'"/>
                                                    </a>
                                                </td>
                                            </tr>
                                        </logic:notEmpty>
                                    </logic:present>
                                </table>
                            </td>
                        </tr>


                    </table>
                </td>
            </tr>
            <tr>
                <td>
                    <%@include file="/jsp/footer.jsp" %></td>
            </tr>
        </table>
    </body>
</html>
